A few words of thanks would be greatly appreciated.

Onclick> javascript with IE, Chrome and Safari

Onclick> javascript with IE, Chrome and Safari


Hello, I have 3 small problems compatibility with a code that works fine on Firefox and Opera, but I do not know how to walk on all browsers.


I have a select switch to change the contents of an iframe by assigning an external site.
<select name="value_url"> <option value="site1.com=" onclick="change_url()"> site1.com </ option> <option value="site2.com" onclick="change_url()"> site2.com </ option> <option value="site3.com" onclick="change_url()"> site3 </ option> </ select>

With onclick call the javascript function but it does not work on IE, Chrome and Safari
change_url function () {var link = document.form_header.value_url.value; parent.frame_url_ext.location.href = link;}

For the size of my iframe is correct according to the size of the page, I recalculated this way:
function Resize () {var as = document.form_header.tableau.offsetHeight; parent.frame_url_ext.height = as;} 

It works on all browsers but IE still leaves me a problem (Though it works)

Error Details of the web page

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6;. NET CLR 1.1.4322;. NET CLR 2.0.50727;. NET CLR 3.0.4506.2152;. NET CLR 3.5. 30729;. NET4.0C;. NET4.0E)
Timestamp: Mon, 24 January 2011 12:16:24 UTC

Message: 'document.form_header.tableau.offsetHeight' is null or not object year
Line: 29
Character: 2
Code: 0
URI: http://localhost/monsiteweb/index.php

Third and last point:

I have a field to upload an image but the result display is not the same on the browsers.http://img413.imageshack.us/img413/4827/browserfirefox.jpg

<tr> <td width="40"> <input type="hidden" name="uploadImage" value="1" /> <input style = "background: # FFFFFF" name = "image" type = "file" size = "70" value = "test" /> </ td> <td colspan="2"> <input type="submit" name="image_upload" value="Envoyer l'image" /> </ td> </ tr>


For the first point, instead uses the onChange event that you will place in the select (remove the onClick options).

For the second point, I lack a bit of html code to understand what stuck (in my opinion is the word table is wrong). At worst, put your variable in an alert and have seen what is posted.

For the third point, this is the basic design of browsers that can be changed in CSS. However, I cannot help you at this level, I do not know how.


Solved by Eastchild

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.


This document, titled « Onclick> javascript with IE, Chrome and Safari », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).