function myMax(anumber, another) {
if (anumber > another) {
return anumber;
}
return another;
}
function resizeTextArea(t,minCols,minRows) {
var lines = 0;
if (t.getAttribute("cols") == null) t.setAttribute("cols",minCols);
if (t.getAttribute("rows") == null) t.setAttribute("rows",minRows);
textLine = t.value.split("
");
// get lines of textbox
lines = t.value.split("
").length;
// get longest row of textbox.
var max = 0;
for (i=0;i < textLine.length;i++) {
if (parseInt(textLine[i].length) >
parseInt(t.getAttribute("cols"))) {
lines += Math.floor(parseInt(textLine[i].length) /
parseInt(t.getAttribute("cols"))) ;
}
}
t.setAttribute("rows",myMax(lines+1,minRows));
}
In Firefox this works really fine! But in IE the text area grows very strange. If I add a line, after a while there seems to be a problem with spacing.
I have a mysql database with a bunch of quotations in it. I created a blog at http:[url]....At the top of the blog is an iframe window that directs to http:[url]....On that page it uses php to pull out a random quote from the database. The iframe window displays that quote onto the blog.It works great except that the height is not automatically resizing.Is there a way I can use javascript to do this instead? Here is some pseudo-code of what I'd like to be able to do: (p.s. I do not know javascript or much of anything so I am looking for people to tell me how to ACTUALLY do this)
var stringvariable = http://aro2220.com/blog/index.html;
I have made a table with a textarea that is resizable. The problem is that when it resizes, it also resizes the table row and columns. Is there a way to fix this? Maybe a way to resize from the right side and bottom of the textarea only.
I found a javascript code online which automatically resizes an IFRAME based on the content loaded into it.
[Code]...
As you can see, the IFRAME I am resizing automatically is called "star_content" - This frame exists on a page with a set of links below it, which determine what content is to be loaded into it. The content being loaded into it is Daily, Monthly and Yearly horoscopes. The longest being the Yearly one. Now when I click the yearly one, the iframe extends as expected... but if I go from the yearly one back to the Daily or Monthly one, it doesn't shrink again so I end up with a huge gap. I can't show you the page itself because it's a closed site, still in development and I am under a non disclosure contract. However, here is the IFRAME HTML.
[Code]....
So to sumarise, what I want to do is have the iframe automatically resize to fit the content that has been loaded within it. It's doing that when it needs to extend the height of the frame but it's not then reducing the height when it goes back to something smaller.
I have 3 divs (boxes) next to each other, I can input text via a textarea to each. I need all 3 to resize - be the same size on text overflow - so if box a gets 100 lines of code and resizes, the other 2 should follow. I have written this js, and added it to the button which moves the text to the boxes (to the onclick)
1. first I have a link for something that works but I want to work better:
[url]
The dynamically resizing textarea boxes are in light orange. They work, but they are rather jerky and you see some "bounce" when adding or removing lines -unlike Face Book which doesn't do this. Can anyone propose a better coding system that is smoother AND less processor intensive?
2. If you really do UNDERSTAND javascript at the programmatic level I'd be interested in having you work regularly for me, but I think I might need to post that in another forum. I'm a PHP programmer, and because I don't understand the JS Kernel and how it thinks, I'm always chasing my tail on it.
How would i change back to the default length of textarea?
I have this comment area that after clicking submit i will append the new comment in the list of comments through ajax... i got one problem though, everything is working perfectly well except for the textarea that won't change back to it's default size...
EXAMPLE:
The problem is that the textareawon't change back to it's default size // let's say that the default size is rows=3
I've read through a number of links that discuss various methods of resizing a div; however, nothing seems to work correctly for me. The basic idea is that I would like to implement is a panel that can be hidden (to save space), but collapses smoothly, rather than all at once.
I've tried setting the div's style.height property. Doing so does, in fact, resize the div (at least in Firefox 2.0); however, the inner text does not disappear as the div is resized. Should I apply another CSS style to the inner text or is there another method of obtaining the desired results? Code:
I am using a popup window to show pictures. Each time the user clicks on a thumbnail in the mail HTML page, the popup either appears or reloads a new picture.
Some pictures are portrait, and some are landscape. I build the popup html dynamically. How can I a) resize the popup window to fit the image, and b) pop it to the forefront once the new picture is loaded?
i have a div, i set the innerHTML property to a formatted paragraph of text. however, at times the text exceeds the width (and height) of the div. how do i create a fixed width div and make it use a scrollbar if the contents exceed the height and width specified. i'm using microsoft visual studio, and i have the width explicitly set in the properties but still on setting the innerHTML it resizes automatically.
I have a frameset page as my index.html page and have noticed that if my page is opened in other resolution than the one it was created in, some pictures shift locatiuons.
If this was a non frames page i knew how to fix it... Is there any was to automaticaly resize a frameset proportionaly to the screen resolution?
ex: i want one picture to be exactly 1/4 of the screen, in a one-page i would do someting like...
We are code crushing the width of images from 285px to 260 pix. However we aren't changing the height. we need a bit of javascript that can make that percentage change to the height as well.
i have an imagemap, and i don't know where to write in the specific size for the new window popping up...if it's possible? i'm having just an "add to cart" page pop up and i don't need a big space..
I'm building a tool for my company and I'm making use of frames in it. I have one frame on the left side and two frames on the right side. I have two forms on the main frame (the left panel) and the user has an option to submit to either frame or to both frames.
I'm wondering: is there any way to resize the right bottom or right top frame via JavaScript if someone submits to only one of the frames?
the code above gets called every time a new page is loaded inside the iframe (ifrmDisplay) what its doing is resizing the iframe so it can have the same size as the page inside it, so i can eliminate the need for vertical scroller for the iframe, i assumed that it works on opera and IE at the same time, when i tried it out, it worked on IE but not on opera. after lot of time in researching how i can get workaround this issue with opera, that is the best possible solution i have and yet it doesnt work. so i gave up and asking you if you can help me out here , coz this is jst driving me crazy!
the problem is im not a javascript expert, to be honest i jst started doing javascripts about two days ago, that is why im in need for help
by the way, here is inner html for the iframe if its any use
the code above gets called every time a new page is loaded inside the iframe (ifrmDisplay) what its doing is resizing the iframe so it can have the same size as the page inside it, so i can eliminate the need for vertical scroller for the iframe, i assumed that it works on opera and IE at the same time, when i tried it out, it worked on IE but not on opera. after lot of time in researching how i can get workaround this issue with opera, that is the best possible solution i have and yet it doesnt work. so i gave up and asking you if you can help me out here , coz this is jst driving me crazy!
the problem is im not a javascript expert, to be honest i jst started doing javascripts about two days ago, that is why im in need for help
by the way, here is inner html for the iframe if its any use
I have a function which caches images for a slideshow once the script has loaded. Here is an exerpt:
var base_ref = "http://www.example.com"; var images = new Array(); var tmp_images = new Array(); tmp_images[0] = "image1.jpg"; tmp_images[1] = "image2.jpg"; tmp_images[2] = "image3.jpg"; tmp_images[3] = "image4.jpg"; tmp_images[4] = "image5.jpg";
function cache_images () { for (var i=0; i < tmp_images.length; i++){ var cacheimage=new Image(); var tmp_name = tmp_images[i]; var url = tmp_images[i] + ".png"; cacheimage.src=url; images[tmp_name]=cacheimage; } }
As it is, the script whizzes through the for loop, and then moves on to the next function. The only trouble is that it moves on to the next function whilst it's still downloading the images from the server. Is there anyway to make the script wait until the downloading is completed, so that I can then go on to resize the images if it's needed?
The below script sets and maintains the equal heights of 2 (or 3) divs which are floated next to each other on a page. I want to ensure that I have not overlooked anything and it will not error. In other words, it either executes successfully or not at all. This script is a compilation of code found on various posts along with my personalization thrown in to meet our specs. Note that this is just a "nice to have" script so if it doesn't execute the page is still usable .....
I run a streaming site and am looking to have the option on a chat room next to the stream. Not everyone likes having the chat facility so I'd like to make it optional.
As the page loads I'd like the content to look like the diagram below with the stream (iframe1) taking up 95% of the page and the other 5% being taken up by an image which will say "open chat". The chat (iframe2) would have a width of 0%. [URL]
Then when the "open chat" image is clicked I'd like the chat (iframe2) to become 35% and the stream (iframe1) to become 60%. If someone could make a nice sliding effect when the image is clicked that'd be even better. Here's a diagram to show what it'd look like with the resized iframes. [URL]
I'm building a page here: http:[url]....I have some JS in place which you can see in the source at the bottom of that page that sets the width of the box surrounding the dark grey image to a certain width (image width + 64px).The problem is that when I first visit that page the box resizes to a really thin width and the image flows out of it, however if I refresh the page the box resizes to the correct width that I want it. Does anybody know why it does this?