SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    my jscript is not running in IE

    hello

    although my javascript runs in firefox, doesn't in IE.

    could you tell me why ?

    <script type="text/javascript">
    var xoffset = 0;
    var yoffset = 0;

    var width;
    height;

    var xx;
    var yy;

    function first() {

    // Burada bir alert 'Burdayım gibi'

    if (document.getElementById) {
    img = document.getElementById('harita:imgMap');
    if (img.style) {

    xoffset = img.style.left;
    yoffset = img.style.top;

    return;

    } else {
    alert('hata first: img.style');
    }

    } else {
    alert('hata first first:document.getElementById');
    }

    if (document.all) {
    imgall = document.all['harita:imgMap'];
    if (imgall.style) {

    xoffset = imgall.style.left;
    yoffset = imgall.style.top;
    return;

    } else {
    alert('hata first: imgall.style');
    }

    }
    // return ???
    }

    function startRubber(evt) {

    // Burada bir alert 'Burdayım gibi'

    first();

    var myReference = null;
    if (document.getElementById) { // burası firefox a uyar Ya explorer
    myReference = document.getElementById('harita:rubberBand');

    } else {
    alert('hata startRubber:document.getElementById');
    }
    if (myReference.style) {
    //DOM & proprietary DOM
    myReference.style.width = 0;
    myReference.style.height = 0;
    myReference.style.left = (evt.clientX) + 'px';
    myReference.style.top = (evt.clientY) + 'px';

    myReference.style.visibility = 'visible';

    var xx = new Number(evt.clientX - parseInt(xoffset));
    var yy = new Number(evt.clientY - parseInt(yoffset));

    xx = xx.toFixed(3);
    yy = yy.toFixed(3);

    upperleft_koord(xx, yy);

    } else {
    alert(' hata startRubber:myReference.style');
    }
    document.onmousemove = moveRubber;

    return;

    }

    function moveRubber(evt) {

    if (document.getElementById) { // burası firefox a uyar // explorer ???
    myReference = document.getElementById('harita:rubberBand');
    myReference.style.width = (evt.clientX - parseInt(myReference.style.left)) + 'px';
    myReference.style.height = (evt.clientY - parseInt(myReference.style.top)) + 'px';

    width = parseInt(myReference.style.width);
    height = parseInt(myReference.style.height);

    } else {
    alert(' hata moveRubber document.getElementById');
    }

    myReference.onmouseup = stopRubber;

    return;
    } //moveRubber

    function stopRubber() {
    myReference.style.visibility = 'hidden';
    myReference = null;
    document.onmousemove = null;
    if (document.getElementById('harita:rect_zoom')) {
    document.getElementById('harita:rect_zoom').value = '0';
    document.getElementById('harita:zoom_rect').src = './images/zoom_rect.png';

    } else {
    alert('hata stopRubber() document.getElementById(harita:rect_zoom ');
    }

    width_height(width, height);
    return;
    //document.forms['harita'].submit();
    } //stopRubber

    //document.onmousedown = startRubber;
    //document.onmouseup = stopRubber;

    function koord_click(event) {
    first();
    fm = 'harita';
    img = document.getElementById(fm + ':harita1');

    if (img) {
    xx = 0;
    yy = 0;
    xx = event.clientX - parseInt(xoffset);
    yy = event.clientY - parseInt(yoffset); // bu değerler değişebilir
    xx = xx.toFixed(3);
    yy = yy.toFixed(3);

    document.getElementById(fm + ':img_clicked').value = '1';

    img_clickxy(xx, yy);

    if (document.getElementById('harita:info_in').value == '1') {
    document.getElementById('harita:info_in').value == '0'
    javascript: Richfaces.showModalPanel('harita:infomodalPanel');
    }

    return;

    } else {
    alert(' img tanımsız' + img);
    }

    } //koord_click

    function zoom_rect() {

    if (document.getElementById) {

    document.getElementById('harita:zoom_rect').src = './images/zoom_rect_gray.png';

    if (document.getElementById('harita:rect_zoom').value == '0') {
    document.getElementById('harita:rect_zoom').value = '1';
    document.getElementById('harita:info_in').value = '0';
    document.getElementById('harita:infobutton').src = './images/Info24.png';
    }
    return;
    } else {
    alert('hata zoom_rect() document.getElementById tanımsız');
    }

    return;
    }
    </script>

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,819
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    A colon is not a valid character in an id. All ids must start with a letter and be alphanumeric
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't see where the event object is being assigned for Internet Explorer:

    Code:
    function startRubber(evt) {
      var evt = (evt) ? evt : window.event;
    And similarly for the moveRubber(evt) and koord_click(event) functions.

  4. #4
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    A colon is not a valid character in an id. All ids must start with a letter and be alphanumeric
    thank you

    Don't we use that format in jsf-jsp page. And it runs in Firefox normally.

  5. #5
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lnhicks View Post
    I can't see where the event object is being assigned for Internet Explorer:

    Code:
    function startRubber(evt) {
      var evt = (evt) ? evt : window.event;
    And similarly for the moveRubber(evt) and koord_click(event) functions.
    thank you

    I will work on it as you have suggested.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •