Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to pass value to object data

    I want to pass the value to my object id = "Parameters"
    How can I do that?
    I had tried the code as posted below but it couldn't work.
    I'm using document.all.Parameters.data = tempParams[0]; to pass in the data to
    <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800
    width=1060 VIEWASTEXT scroll=yes></OBJECT>
    I also have tried document.getElementById("Parameters").data = tempParams[0]; but still doesn't work.

    The code attached as below.
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"



    <
    html
    <
    head
    <
    title>Management System Manual</title



    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"

    <
    script language="JavaScript" type="text/JavaScript"
    <!-- 
    function 
    MM_reloadPage(init) {  //reloads the window if Nav4 resized 
      
    if (init==truewith (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { 
        
    document.MM_pgW=innerWidthdocument.MM_pgH=innerHeightonresize=MM_reloadPage; }} 
      else if (
    innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgHlocation.reload(); 

    MM_reloadPage(true); 

    function 
    right(e) { 
    if (
    navigator.appName == 'Netscape' &&  
    (
    e.which == || e.which == 2)) 
    return 
    false
    else if (
    navigator.appName == 'Microsoft Internet Explorer' &&  
    (
    event.button == || event.button == 3)) { 
    alert("Sorry, you do not have permission to right click."); 
    return 
    false

    return 
    true


    document.onmousedown=right
    document.onmouseup=right
    if (
    document.layerswindow.captureEvents(Event.MOUSEDOWN); 
    if (
    document.layerswindow.captureEvents(Event.MOUSEUP); 
    window.onmousedown=right
    window.onmouseup=right
    //  End --> 
    </script> 

    <script type="text/javascript" language="JavaScript1.2">  
    <!-- // Begin 
    //Disable right click script 
    //no alert 

    var message=""; 
    /////////////////////////////////// 

    function onKeyDown() { 
    if ( (event.altKey) || ((event.keyCode == 8) &&  
    (event.srcElement.type != "text" && 
    event.srcElement.type != "textarea" && 
    event.srcElement.type != "password")) ||  
    ((event.ctrlKey) && ((event.keyCode == 82)) ) || 
    (event.keyCode == 68) ||  
    (event.keyCode == 80) || 
    (event.keyCode == 78) || 
    (event.keyCode == 66) || 
    (event.keyCode == 72) || 
    (event.keyCode == 73) || 
    (event.keyCode == 74) || 
    (event.keyCode == 70) || 
    (event.keyCode == 122)  
    ) { 
    event.keyCode = 0; 
    event.returnValue = false; 



    function clickIE() {if (document.all) {(message);return false;}} 
    function clickNS(e) {if  
    (document.layers||(document.getElementById&&!document.all)) { 
    if (e.which==2||e.which==3) {(message);return false;}}} 
    if (document.layers)  
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 

    document.oncontextmenu=new Function("return false") 




    //  End --> 
    </script> 
    <script type="text/javascript" language="JavaScript1.2">  


    function getParams() { 
    var idx = document.URL.indexOf('?'); 
    var idx1 = document.URL.indexOf('#'); 
    var tempParams = new Object(); 

    if (idx != -1) { 
    var pairs = document.URL.substring(idx+1, idx1).split('?'); 

    //pairs = 1; 
    for (var i=0; i<pairs.length; i++) { 
    nameVal = pairs[i].split('='); 

    tempParams[0] = nameVal[1]; 



    //document.getElementById("Parameters").data = tempParams[0]; 
    //document.all.Parameters.data = tempParams[0]; 

    document.all.Parameters.data = tempParams[0]; 
    //alert (window.document.parameters.data); 

    return false; 



    </script > 

    </head> 

    <style media="print"> 
    body  

    display : none; 

    </style> 

    </HEAD> 

    </head> 

    <!-- <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=setInterval("window.clipboardData.clearData();getParams();",2)  oncontextmenu="return false" scroll=yes > --> 
    <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=getParams() oncontextmenu="return false" scroll=yes  > 

    <!--<input id="abc" type="text"/>--> 
    <form id="frmRestricted" method="post"> 

    <div id="Layer2" style="position:absolute; left:0px; top:-35px; width:1060; height:800; z-index:201">  
      <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800  
        width=1060 VIEWASTEXT  scroll=yes></OBJECT> 
    </div>  
    </form> 
    </body> 
    </html>  

    Thank you very much 

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    First at all, bring your code up-to-date. References like document.all (old IE) and document.layers (Netscape) are medieval. In modern javascript, references are to be done upon id - document.getElementById(); in some cases by name - document.getElementsByName(); by their tag name - document.getElementsByTagName(); or by their position in DOM tree - as childNodes or sibling position.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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