JavaScript - Javascript Working On Local But Not Working When Uploaded To Host.
I hope I have this post in the right place! Any help would be very much appreciated...
I have a feature on my website that allows users to choose the website background (using alternate css sheets) and then uses an externally linked javascript file to store the background choice as a cookie so it is consistent throughout the website. This works perfectly locally (i.e. when previewing my website on my computer) but now it is uploaded to my host it doesn't appear to be working. (with the same browser) My javascript is he http://www. b r p - e n v .com/javascript/backgroundchange.js (with no spaces) The website that the javascript file is linked to is http://www. b r p - e n v .com (with no spaces) In the head I have: <script type="text/javascript" src="../javascript/backgroundchange.js"></script> ...then I have: <body onload="set_style_from_cookie()"> ...and for users to choose which background: <form> <input type="image" src="../images/white-background-thumb.jpg" onclick="switch_style('bg1');return false;" name="theme" value="White" id="bg1"> etc... </form> My problem is: The background reverts back to the default when moving to a different page. This would indicate that the background choice is not being saved in cookies. But this works locally! I have tried putting the javascript directly onto each page but I still had the same problem. I hope someone can help, I will be so grateful if I can get this to work. Many thanks indeed! Similar TutorialsHi, I am working on the following page: http://www.reutin-international.com/redirect.html There is a news script on the right-handside which rotates news items (a kind of scroller). Locally this works without any problems, but once I've uploaded it to the hosting server this doesn't work. There is no javascript error sign. I have double checked with the hosting and they support javascript by default. If anyone has any ideas it'd be appreciated! Thanks! I have a usercontrol which get inputs from the user and show the slideshows. I have added jquery.js and jqfancytransitions.js to the control. when i apply the effects dynamically it is working on local iis but the same coding is not working on iis server. The link for the page is http://www.gloriatech.com/slideshow.aspx . Actually it display the images but no effects are applied. I also checked the js files, it is in right path only.When i checked this page in firebug , it shows the error which is " Sys is undefined". I dont know how to solve it. Can anyone help me? Thanx in advance. Hi,
I have designed a site. It's working properly in locally.
Now I want to insert a special javascript on my home page.
The job of that special javascript is, makes some errors in the site when site is going to publish on internet.
The site should run on locally but not on server I know that's a strange requirement . But that's a test for me... Is there any, this kind of special javascript...??? please help me. thanx hereis the html file and javascripton click of this button a html ***************************** <table class=matcolor id=topnav cellspacing=0 cellpadding=0 width=550 border=0 bgcolor="#FFCCCC"> <tbody> <tr align=middle> <td id=menu1 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Desk Top Publishing </font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu2 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Transcription</font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu3 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Accounts Processing </font></div> </td> </tr> </tbody> </table> ***************************************** <script language=JavaScript> ix = document.getElementById('tblmenu1').getBoundingClientRect(); new ypSlideOutMenu("menu1", "right",ix.left + ix.right ,ix.bottom + 10); </script> **any thing i have to alter to work in firefox please help Ok, here's the page as it is right now: http://www.crackin.com/dev/index.php The paganation for the top 3 images is Sweet Pages: http://tutorialzine.com/2010/05/swee...tion-solution/ The content loading below is a page-replace script I got he http://css-tricks.com/dynamic-page-replacing-content/ And I'm also trying to integrate shadowbox (or lightbox, whichever will work) into the lower set of images. I have 2 problems right now I can't figure out, and I'm sure it somehow has to do with the fact I'm trying to mash 3 different JS addons into a single page, I'm still pretty new to this whole JS thing... First problem I'm having is that IE7 and Opera don't like the links in the upper images. Clicking a gallery image does not load the associated page below from those 2 browsers, however IE8 and FF seem to work fine. Second problem is getting shadowbox/lightbox to work on those lower images. I tried a couple different things but main thing I did is make sure the script is actually working by setting the header text to a link with shadowbox attached and that worked. That same link doesn't work when applied to the lower images (loads image in new window). Lightbox does the same thing. Thanks for any help. Hi All, I have two sites using zeroclipboard (hosted at google code) one works only in firefox and barely, the other is not working at all. It does use Flash, but I think the issue is on the js side of things. On both links, clicking the filename below the thumbnail will copy and add the link as an IMG code to a div below. *working* link http://pics.boasbysatyra.com/access/spiders.php This one only works in FF, and the clip area is offset badly. Here is the template for the zc code: Code: <div class="photo" style="float: left; padding: 4px;"> <div class="exif"><a href="[~41~]?dir=[+images_dir+]&file=[+filename+]" rel="shadowbox[exif_[+content_id+]]" title="exif data for [+filename+]" alt="exif data for [+filename+]">EXIF Data</a></div> <a class="thumb" rel="shadowbox[[+content_id+]]" href="[+images_dir+][+filename+]" title="[+title+] | [+description+]"> <img src="[+thumbs_dir+][+filename+]" alt="[+title+]" /> </a> <div class="filecode" id="d_clip_button[+filename+]">[+filename+] <script language="JavaScript"> var clip = new ZeroClipboard.Client(); clip.setText( 'http://pics.boasbysatyra.com[+images_dir+][+filename+]' ); clip.glue( 'd_clip_button[+filename+]' ); clip.addEventListener( 'onComplete', my_complete ); function my_complete( client, text ) { $('.picklist').append('<div class="piclinks">[IMG]' + text + '[/IMG]</div>'); } </script> </div> </div> And the JS for the page: Code: var needRef; //flag for page reload function pEdit(){ needRef = 1; } Shadowbox.init({ handleOversize: "resize", modal: true, initialHeight: 32, initialWidth: 400, overlayOpacity: 0.85, onClose: function(){//check for reload flag and reload if (needRef == 1){window.location.href=window.location.href;} } }); ZeroClipboard.setMoviePath('/js/zc/ZeroClipboard10.swf'); function initMenu() { $('#menu ul').hide(); $('#menu ul:first').show(); $('#menu li a').click(function() { var checkElement = $(this).next(); if ((checkElement.is('ul')) && (checkElement.is(':visible'))) { //return false; } if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $('#menu ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } }); } $(document).ready(function() { initMenu(); }); Now on to the totally broken one - it creates the elements required, but gives them a 0x0 area! http://jb.boasbysatyra.com/forum-pic...cs/nature.html Code: div class="photo" style="float: left; margin: 4px;"> <div class="exif"><a href="[~133~]?dir=[+images_dir+]&file=[+filename+]" rel="shadowbox[exif_[+content_id+]]" title="exif data for [+filename+]" alt="exif data for [+filename+]">EXIF Data</a></div> <a class="thumb" rel="shadowbox[[+content_id+]]" href="[+images_dir+][+filename+]" title="[+title+] | [+description+]"> <img src="[+thumbs_dir+][+filename+]" alt="[+title+]" /> </a> <div id="d_clip_container[+filename+]" style="position:relative; width: 120px; height: 0.5em;"> <div class="filecode" id="d_clip_button[+filename+]">[+filename+] <script language="JavaScript"> var clip = new ZeroClipboard.Client(); clip.setText( 'http://jb.boasbysatyra.com[+images_dir+][+filename+]' ); clip.glue( 'd_clip_button[+filename+]','d_clip_container[+filename+]' ); clip.addEventListener( 'onComplete', my_complete ); function my_complete( client, text ) { $('.picklist').append('<div class="piclinks">[IMG]' + text + '[/IMG]</div>'); } </script> </div> </div> </div> On this one I wrapped it as suggested on the zc site, I originally started with the code for the other site - it didn't work, so I went tweaking... Here is the JS: Code: var needRef; //flag for page reload function pEdit(){ needRef = 1; } Shadowbox.init({ handleOversize: "resize", modal: true, initialHeight: 32, initialWidth: 400, overlayOpacity: 0.85, onClose: function(){//check for reload flag and reload if (needRef == 1){needRef = 0; window.location.href=window.location.href;} } }); ZeroClipboard.setMoviePath('/js/zc/ZeroClipboard10.swf'); $(document).ready(function() { $(".dim img").fadeTo("slow", 0.65); $(".dim img").hover(function(){ $(this).fadeTo("slow", 1.0); },function(){ $(this).fadeTo("slow", 0.65); }); $('#mainContent').hide().fadeIn(1200); //When page loads... $(".tab_content").hide(); //Hide all content // $("ul.tabs li:first").addClass("active").show(); //Activate first tab // $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); (function($) { $(document).ready(function(){ $('.menu1').ptMenu(); $('.menu2').ptMenu({vertical:true}); }); })(jQuery); I have taken a look at this for a few days and tried many things with no luck, any help is appreciated. Thanks! Hello i need help to find errors in that javascript i am trying to find the error but i could not i really need your help please here the javascript code <html> <head> <title>Textbox and submission button</title> <script language = "Javascript"> function display_messages() { if (var textentered = " message1") { alert (" This is message 1"); } else if (var textentered = " message2") { alert (" This is message 2"); } else if (var textentered = " message3") { alert (" This is message 3"); } else if (var textentered = " message4") { alert (" This is message 4"); } else if (var textentered = " message5") { alert (" This is message 5"); } else alert (" message name is not found"); } } var textentered = document.form1.textbox1.value var messages = new Array(5); alert(messages[0][1] = ["message1", "This is message 1"]); alert(messages[1][2] = ["message2", "This is message 2"]); alert(messages[2][3] = ["message3", "This is message 3"]); alert(messages[3][4] = ["message4", "This is message 4"]); alert(messages[4][5] = ["message5", "This is message 5"]); onclick="displayMessage();"; </head> </script> <body onclick="alert(document.form1.textbox1.button);"> <form name="form1"> <table border="0" cellspacing="0" cellpadding="5" width="60%" align="center"> <tr> <td>Textbox 1:</td> <td><input type="text" name="textbox1" value="" /> <input type="button" name="button" value="Submit" onclick="function_display_message();"/> </td> </tr> </table> </form> </body> </html> Can someone help me please I thank you for the help in advance. I am a total noob when it comes to Javascript but I am working on learning it. I am working on a site and used this script http://livepipe.net/ It works in ie fine on their site, but not on mine. On my site it runs on every browser except IE and generates the errors below. It is probably a small issue but please don't get fustrated with my ignorance on js. I am very new to javascript. I usually pay for somebody to do it for me but my connect is not around right now so I am stuck fixing this issue. Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; Comcast Install 1.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729) Timestamp: Fri, 7 May 2010 15:55:29 UTC Message: Object doesn't support this property or method Line: 472 Char: 464 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 12 Char: 2854 Code: 0 URI: http://roadhouserestoration.com/site...y.js?ver=1.3.2 Message: Object doesn't support this property or method Line: 1 Char: 1 Code: 0 URI: http://roadhouserestoration.com/site...pts.js?ver=2.2 Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js Message: Object doesn't support this property or method Line: 460 Char: 1 Code: 0 URI: http://roadhouserestoration.com/js/all.js The actual address to the website is http://roadhouserestoration.com/site I have a jumpmenu that opens a shadowbox to show an image. It works fine in IE9, but in IE7 the shadowbox does not open and in the developer tools the error says "The value of the property 'MM_jumpMenu' is null or undefined, not a Function object". Being a noob I have no idea what the problem is. The coding in the <head> is; Code: <script type="text/javascript" src="shadowbox.js"></script> <script type="text/javascript"> Shadowbox.init(); </script> <script type="text/javascript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 if (selObj.selectedIndex == 0) return; Shadowbox.open({ content: selObj.options[selObj.selectedIndex].value, player: 'img', }); if (restore) selObj.selectedIndex=0; } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> And in the <body> is; Code: <div id="apDiv2"> <form name="form1" id="form1"> <select name="Tema Demo" onchange="MM_jumpMenu('parent',this,0)"> <option value="Select Campsite" selected="selected">Select Campsite</option> <option value="/images/stories/campsite_images/Site (1)/1.jpg">Site 1</option> <option value="/images/stories/campsite_images/Site (3)/3.jpg">Site 3</option> </select> </form> </div> There are more options than this but I reduced them down for convenience. Any help would be greatly appreciated. Many thanks, Keith. Hi, currently we are using IE 7 in that for showing submenu we are using the following code but it is not working in google chrome and firefox..basically it is a seperate .js file where functions are stored Code : Code: if( typeof ( gCSSList ) == 'undefined' || gCSSList == null ) var gCSSList= new Array();gCSSList[1]= Array('MENU_BLOCK_1','MENU_ITEM_1','MENU_ITEM_HL_1','MENU_ITEM_SL_1','MENU_ITEM_COL_LEFT_1','MENU_ITEM_COL_LEFT_HL_1','MENU_ITEM_COL_LEFT_SL_1','MENU_ITEM_COL_RIGHT_1','MENU_ITEM_COL_RIGHT_HL_1','MENU_ITEM_COL_RIGHT_SL_1','MENU_ITEM_HEADING_1','SUBMENU_BLOCK_1'); var gMainmenuFrm = 'left'; var gSubmenuFrm = 'right'; if( typeof ( gTimer ) == 'undefined' || gTimer == null ) var gTimer = new Array(); if( typeof ( HLItemList ) == 'undefined' || HLItemList == null ) var HLItemList = new Array(); if( typeof ( MenuList ) == 'undefined' || MenuList == null ) var MenuList = new Array(); function vMenu_AddtoHLList ( pCtrlId, pItemId ) { if( typeof ( HLItemList[pCtrlId] ) == 'undefined' || HLItemList[pCtrlId] == null ) HLItemList[pCtrlId] = pItemId+ ','; else HLItemList[pCtrlId] = HLItemList[pCtrlId] + pItemId+ ','; } function vMenu_AddtoMenuList ( pCtrlId, pMenuID ) { if( typeof ( MenuList[pCtrlId] ) == 'undefined' || MenuList[pCtrlId] == null ) MenuList[pCtrlId] = pMenuID + ','; else MenuList[pCtrlId] = MenuList[pCtrlId] + pMenuID + ','; } function vMenu_HideSubmenu ( pCtrlId, pMenuLevel ) { try { var MenuStr = new String(); objFrm = window.parent.frames(gSubmenuFrm); if( typeof ( MenuList[pCtrlId] ) == 'undefined' || MenuList[pCtrlId] == null ) return; MenuStr = MenuList[pCtrlId]; MenuArr = MenuStr.split(','); for( i=0; i < ( MenuArr.length - 1 ); i++ ) { MenuIds = MenuArr[i].split('_'); if( MenuIds[2] > pMenuLevel ) { object = objFrm.document.getElementById(MenuArr[i]); object.style.visibility = "hidden"; objFrm.document.getElementById('IF_'+object.id).style.visibility="hidden"; MenuStr = MenuStr.replace(MenuArr[i]+',',''); } } MenuList[pCtrlId] = MenuStr; } catch(e) { } } function vMenu_UnHilightItems ( pCtrlId, pLevel ) { objFrm = window.parent.frames(gSubmenuFrm); var ItemStr = new String(); ItemStr = HLItemList[pCtrlId]; if( typeof ( HLItemList[pCtrlId] ) == 'undefined' || HLItemList[pCtrlId] == null ) return; ItemArr = ItemStr.split(','); for( i=0; i < ( ItemArr.length - 1 ); i++ ) { ItemIds = ItemArr[i].split('_'); if(ItemIds[2] >= pLevel ) { if( ItemIds[2] == 1 ) { objmfr = window.parent.frames(gMainmenuFrm); object = objmfr.document.getElementById(ItemArr[i]); object.className = gCSSList[pCtrlId][1]; objmfr.document.getElementById(object.id+'_1').className = gCSSList[pCtrlId][4]; objmfr.document.getElementById(object.id+'_2').className = gCSSList[pCtrlId][7]; } // case : Item will be on submenu frame, use submenu frame reference to unhighlight item else { object = objFrm.document.getElementById(ItemArr[i]); object.className = gCSSList[pCtrlId][1]; objFrm.document.getElementById(object.id+'_1').className = gCSSList[pCtrlId][4]; objFrm.document.getElementById(object.id+'_2').className = gCSSList[pCtrlId][7]; } ItemStr = ItemStr.replace(ItemArr[i]+',',''); } } HLItemList[pCtrlId] = ItemStr; } function vMenu_HighlightItems ( pCtrlId, pEventItemId, EventFrm ) { objFrm = window.parent.frames(EventFrm); objFrm.document.getElementById(pEventItemId).className = gCSSList[pCtrlId][2]; objFrm.document.getElementById(pEventItemId+'_1').className = gCSSList[pCtrlId][5]; objFrm.document.getElementById(pEventItemId+'_2').className = gCSSList[pCtrlId][8]; } function vMenu_MenuItem_OnClick ( pTargetPage, pTargetType, pEventItem, pTargetFeatures, pReplace ) { var EventItemId = pEventItem.id; var IDs = EventItemId.split('_'); var CtrlId = new Number(IDs[1]); vMenu_HideSubmenu( CtrlId, 0 ); vMenu_UnHilightItems( CtrlId, 0 ); window.open( pTargetPage, pTargetType, pTargetFeatures, pReplace ); } item function vMenu_MenuItem_OnMouseOut ( pEventItem ) { var EventItemId = pEventItem.id; var IDs = EventItemId.split('_'); var CtrlId = new Number(IDs[1]); var Level = new Number(IDs[2]); vMenu_setMenuTimer ( CtrlId ); } function vMenu_MenuItem_OnMouseOver ( pEventItem ) { var EventItemId = pEventItem.id; var EventFrm = window.name; // split item id, to get detail about item var IDs = EventItemId.split('_'); var CtrlId = new Number(IDs[1]); var Level = new Number(IDs[2]); var ItemType = new Number(IDs[3]); var ItemIndex = new Number(IDs[4]); vMenu_clearMenuTimer ( CtrlId ); if( ( ItemType == 1 ) || ( ItemType == 4 ) ) return; vMenu_HideSubmenu ( CtrlId, Level ); vMenu_UnHilightItems( CtrlId, Level ); if( ItemType == 3 ) { MenuId = 'MNU_' + CtrlId + '_' + (Level+1) + '_' + ItemIndex; vMenu_ShowSubmenu ( EventItemId, MenuId ); vMenu_AddtoMenuList ( CtrlId, MenuId ); } vMenu_HighlightItems ( CtrlId, EventItemId, EventFrm ); vMenu_AddtoHLList ( CtrlId, EventItemId ); } function vMenu_ShowSubmenu ( pEventItemId, pMenuID ) { try { var IDs = pEventItemId.split('_'); var Level = new Number(IDs[2]); var SFrm; if ( Level == 1 ) { SFrm = window.name; objectfrm = window.parent.self; } else { SFrm = gSubmenuFrm; objectfrm = window.parent.frames(SFrm); } objtgtfrm = window.parent.frames(gSubmenuFrm); windowHeight = vMenu_GetWindowHeight ( SFrm ); windowYOffset = vMenu_GetWindowYOffset ( SFrm ); TopVal = vMenu_GetObjectTop ( pEventItemId, SFrm ); object = objtgtfrm.document.getElementById ( pMenuID ); tMenuHeight = object.offsetHeight; if ( Level == 1 ) { windowSubHeight = vMenu_GetWindowHeight ( gSubmenuFrm ); TopVal = TopVal - windowYOffset; windowSubYOffset = vMenu_GetWindowYOffset ( gSubmenuFrm ); TopVal = TopVal + windowSubYOffset; if ( ( TopVal + tMenuHeight ) > ( windowSubHeight + windowSubYOffset ) ) { TopVal = windowSubHeight + windowSubYOffset - tMenuHeight; if(TopVal < 0) TopVal = 0; } } else { if ( ( TopVal + tMenuHeight ) > ( windowHeight + windowYOffset ) ) { TopVal = windowHeight + windowYOffset - tMenuHeight; if(TopVal < 0) TopVal = 0; } } windowXOffset = vMenu_GetWindowXOffset ( gSubmenuFrm ); if ( Level == 1 ) { LeftVal = windowXOffset; } / else { windowWidth = vMenu_GetWindowWidth ( gSubmenuFrm ); LeftVal = vMenu_GetObjectLeft ( pEventItemId, gSubmenuFrm ); object = objectfrm.document.getElementById ( pEventItemId ); ParentWidth = object.offsetWidth; object = objtgtfrm.document.getElementById ( pMenuID ); tMenuWidth = object.offsetWidth; LeftVal = ParentWidth + LeftVal; if (LeftVal + tMenuWidth > windowWidth + windowXOffset) { LeftVal = LeftVal-ParentWidth-tMenuWidth; // case : calculated left is out of window area, set left to zero if(LeftVal<0) LeftVal = 0; } } // set left and top of menu object(table) object.style.left = LeftVal; object.style.top = TopVal; // set visibility of menu object to true object.style.visibility = "visible"; // set iframe position and dimension in such a way that it is displayed // at the same location and of the same dimention object_if = objtgtfrm.document.getElementById('IF_'+object.id); object_if.style.width = object.offsetWidth; object_if.style.height = object.offsetHeight; object_if.style.top = object.style.top; object_if.style.left = object.style.left; // set visibility of iframe related to menu object_if.style.visibility = "visible"; } catch (e) { // debug // alert ('exception:'+e); } } // function determines width of specified frame window // ???? Unsure which condition gives value under which scenario. function vMenu_GetWindowWidth ( pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); if ( objectfrm.document.documentElement && objectfrm.document.documentElement.clientWidth ) { value = objectfrm.document.documentElement.clientWidth; } else if ( objectfrm.document.body ) { value = objectfrm.document.body.clientWidth; } if ( isNaN ( value ) ) { value = top.innerWidth; } return (value); } // function determines height of the specified frame window // ???? Unsure which condition gives value under which scenario function vMenu_GetWindowHeight ( pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); if ( objectfrm.document.documentElement && objectfrm.document.documentElement.clientHeight ) { value = objectfrm.document.documentElement.clientHeight; } else if ( objectfrm.document.body ) { value = objectfrm.document.body.clientHeight; } if ( isNaN ( value ) ) { value = top.innerHeight; } return (value); } // function that determines verticle offset of specified frame window (based on verticle scroll position) // ???? Unsure which condition gives value under which scenario function vMenu_GetWindowXOffset ( pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); if ( objectfrm.document.documentElement && objectfrm.document.documentElement.scrollLeft ) { value = objectfrm.document.documentElement.scrollLeft; } else if ( objectfrm.document.body ) { value = objectfrm.document.body.scrollLeft; } return (value); } // function that determines horizontal offset of specified frame window (based on verticle scroll position) // ???? Unsure which condition gives value under which scenario function vMenu_GetWindowYOffset ( pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); if ( objectfrm.document.documentElement && objectfrm.document.documentElement.scrollTop ) { value = objectfrm.document.documentElement.scrollTop; } else if ( objectfrm.document.body ) { value = objectfrm.document.body.scrollTop; } return (value); } // calculate Left position of given object from left of the document function vMenu_GetObjectLeft ( pObjectName, pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); object = objectfrm.document.all(pObjectName); // Loopthru parents to calculate left value // until parent is Body or does not have parent container while ( object.tagName != "BODY" && object.offsetParent ) { // retrives reference to the container object of given object object = object.offsetParent; value += object.offsetLeft; } return (value); } // calculates Top position of given object from tope of the document function vMenu_GetObjectTop ( pObjectName, pFrm ) { var value = 0; objectfrm = window.parent.frames(pFrm); object = objectfrm.document.all(pObjectName); value = object.offsetTop; // Loopthru parents to calculate top value // until parent is Body or does not have parent container while ( object.tagName != "BODY" && object.offsetParent ) { // retrives reference to the container object of given object object = object.offsetParent; value += object.offsetTop; } return (value); } // this function sets timer, and Function to be executed after timer time out // settimeout function returns reference, whcih can be used to clear timer // this function is called on mouse out of Menu item, so that Menu is closed automatically after some time function vMenu_setMenuTimer ( pCtrlId ) { gTimer[pCtrlId] = setTimeout('vMenu_HideSubmenu('+pCtrlId+',0);vMenu_UnHilightItems('+pCtrlId+',0);', 1000); } // this function clears timer using timer reference available, called onmouse over of menu item function vMenu_clearMenuTimer ( pCtrlId ) { clearTimeout(gTimer[pCtrlId]); } Experts, I'm banging my head against the wall with this one. http://www.dev.sgpconsulting.co.uk/weprintstuff The large header banner on the homepage is a Javascript slideshow used to generate interest in individual products. It works fine in IE, but not at all in FF or Chrome, and I can't figure out why. I'd really appreciate any advice anyone can offer. Steve Hello, I have a website that has some javascript on it, this works fine in Chrome, Opera, Safari and Firefox but not IE (any version I've tried). I've installed Firebug to try to help debug it but that doesn't pick up any issues. I'm not very good when it comes to javascript so would appreciate any assistance. The page with the javascript is he http://www.fantasy-f1-league.com/team3.php You will need to login, please use these details: user: test pw: test The javascript is supposed to update the "Remaining Budget" as you choose options from the dropdowns, it also does a few other things such as prevents submission of invalid team selections. Thanks for any assistance. David wat's good.I tried the script at http://www.javascriptkit.com/script/script2/dropdownpanel.shtml but it's not working the right way.I followed what the tut suggests but still issue over issue.when I click on panel button it goes back but not on the page content.i don't know if need to change something in the css file or the js file. Appreciate your help! Hello, I am learning some javascript and was testing this code from this site: Code: <script type='text/javascript'> function lengthRestriction(elem, min, max){ var uInput = elem.value; if(uInput.length >= min && uInput.length <= max){ return true; }else{ alert("Please enter between " +min+ " and " +max+ " characters"); elem.focus(); return false; } } </script> <form> Username(6-8 characters): <input type='text' id='restrict'/> <input type='button' onclick="lengthRestriction(document.getElementById('restrict'), 6, 8)" value='Check Field' /> </form> It only works when I click the "Check Field" button. It does not work when I hit "Enter" button on my keyboard, while it does on that site. Can anyone give me some idea what's going on? How can this be solved? Thanks for your help I write javascript for image slide show. Code: var mygallery=new fadeSlideShow({ wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow dimensions: [380, 469], //width/height of gallery in pixels. Should reflect dimensions of largest image imagearray: [ <?php $q2 = mysql_query("select * from home_flash"); $i = 0; while($res = mysql_fetch_array($q2)) { $image[$i] = $res[1]; $text[$i] = $res[2]; $str = "['images/fla/".$image[$i]."','','','".$text[$i]."'],"; echo $str; $i++; } ?> //<--no trailing comma after very last image element! ], displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false}, persist: false, //remember last viewed slide and recall within same session? fadeduration: 500, //transition duration (milliseconds) descreveal: "always", togglerid: "" }) In IE I got an error Quote: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2) Timestamp: Sat, 20 Mar 2010 06:22:10 UTC Message: 'imagearray[...].0' is null or not an object Line: 37 Char: 3 Code: 0 If you have solution for thi, then please help with it! Thanks for your precious time. Cheers!! The javascript for the live chat button, makes the rest of the javascript for the navigation not work and only in internet explorer please help. <!--start http://www.livehelpnow.net --> <div style="text-align: center;"> <div> <script type="text/javascript"> var lhnJsHost = (("https:" == document.location.protocol) ? "https://" : "http://"); document.write(unescape("%3Cscript src='" + lhnJsHost + "www.livehelpnow.net/lhn/scripts/lhnvisitor.aspx?div=&zimg=33&lhnid=8456&iv=1&iwidth=101&iheight=35&zzwindow= 0&d=0&custom1=&custom2=&custom3=' type='text/javascript'%3E%3C/script%3E"));</script> </div> <div><a title="Help desk software" href="http://www.LiveHelpNow.net/" style="font-size:10px;" target="_blank">Help desk software</a></div> </div> <!--end http://www.livehelpnow.net --> document.write("<div class='nav' style='color: #0050A3;'>Products <img src='/images/dnav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/force_gauge.html'>Force Gauges <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-torque.html'>Torque Gauges <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-indicat.html'>Sensors & Indicators <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-loadcells.html'>Smart Load Cells <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href=\"javascript: block_closed('menu3','arrow3');\">Test Stands</a> <a href=\"javascript: block_closed('menu3','arrow3');\"><img src='/images/unav_arrow.gif' alt='' id='arrow3' width='10' height='10' border='0'></a></div>"); document.write("<ul id='menu3' class='nav_l3'>"); document.write("<li><a href='/instruments/menu-stands.html'>Motorized Test Stands</a></li>"); document.write("<li><a href='/instruments/menu-manualstands.html'>Manual Test Stands</a></li>"); document.write("</ul>"); document.write("<div class='nav_l2'><a href='/instruments/menu-testsys.html'>Ergonomics Test Kits <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-grips.html'>Grips & Attachments <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-accessories.html'>Accessories <img src='/images/onav_arrow.gif' alt='' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-software.html'>Software <img src='/images/onav_arrow.gif' alt='' id='arrow7' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-testers.html'>Configuring A System <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav_l2'><a href='/instruments/menu-legacy.html'>Legacy Products <img src='/images/onav_arrow.gif' alt='' id='arrow4' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/services/general.html'>Services <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/downloads.html'>Downloads <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/news.html'>News <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/warranty.html'>Product Registration <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/applications/index.html'>Gallery <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/inquiries.html'>Inquiries <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></a></div>"); document.write("<div class='nav'><a href='/about.html'>About Mark-10</a> <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></div>"); document.write("<div class='nav'><a href=\"javascript: block_closed('menu8','arrow6');\">Where To Buy <img src='/images/unav_arrow.gif' alt='' id='arrow6' width='10' height='10' border='0'></a></div>"); document.write("<ul id='menu8' class='nav_l3'>"); document.write("<li><a href='/order.html'>Ordering Direct</a></li>"); document.write("<li><a href='/distributor-us.html'>US Distributors</a></li>"); document.write("<li><a href='/distributor-intl.html'>International Distributors</a></li>"); document.write("<li><a href='/distributor-catalogs.html'>Catalog / Web Sales</a></li>"); document.write("<li><a href='/gsa.html'>US Government Purchases</a></li>"); document.write("<li><a href='/reseller.html'>Become a Reseller</a></li>"); document.write("</ul>"); document.write("<div class='nav'><a href=\"javascript: block_closed('menu9','arrow6');\">Resources <img src='/images/unav_arrow.gif' alt='' id='arrow6' width='10' height='10' border='0'></a></div>"); document.write("<ul id='menu9' class='nav_l3'>"); document.write("<li><a href='/tools/load.html'>Conversion Calculators</a></li>"); document.write("<li><a href='/faq.html'>Frequent Questions</a></li>"); document.write("</ul>"); document.write("<div class='nav'><a href='/contact.html'>Contact Us</a> <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></div>"); document.write("<div class='nav'><a href='/index.html'>Home</a> <img src='/images/onav_arrow.gif' width='10' height='10' border='0'></div>"); document.write("<div style='margin-top:15px;'><a href='http://www.mark-10.com/gsa.html'><img src='http://www.mark-10.com/images/GSA-small.gif' border='0'></></div>"); document.write("<div style='margin-top:15px;'><a href='http://www.mark-10.com/video.html'><img src='http://www.mark-10.com/images/Video-logo.jpg' width='154' height='54' border='0'></></div>"); document.write("<div style='margin-top:15px; text-align:center;'><a href='http://mark-10blog.blogspot.com'><img src='http://www.mark-10.com/images/blogger_logo.png' style='border:0;'><a href='http://www.facebook.com/pages/Mark-10-Force-Measurement/138943942794711'><img src='http://www.mark-10.com/images/facebook-logo.png' style='border:0;'></></div>"); //http://mark-10blog.blogspot.com I have this problem with a javascript in Internet Explorer 7 and maybe 6. in all browsers it's working fine, but not in IE 7. i've tried security settings and adding to safe websites, but it's not working. the code if to disable some elements when the other is clicked. here's the code, what is wrong with it? Code: function checkthebox() { $('#toggleElement').attr('checked', true); if ($('#toggleElement').is(':checked')) { $('#vastematen .required').attr('disabled', true); $('#eigenmaten').removeAttr('disabled'); } else { $('#vastematen .required').removeAttr('disabled'); $('#eigenmaten').attr('disabled', true); } } function toggleStatus() { if ($('#toggleElement').is(':checked')) { $('#vastematen .required').attr('disabled', true); $('#eigenmaten :input').removeAttr('disabled'); } else { $('#vastematen .required').removeAttr('disabled'); $('#eigenmaten :input').attr('disabled', true); } } thanks in advance Hey all, great forum! I am wanting to change the CSS properties for a webapp.. The default instance is when the webapp is launched from a safari browser. The part I have trouble with, is defining how to show different CSS when the webapp is launched from the homescreen of a mobile device. Here is the code I am trying, but have no luck: Quote: <script type="text/javascript"> if (window.navigator.standalone == true) { //alert('homescreen'); $('body > #footer').css({bottom: '0px !important'}); $('body > #wrapper').css({bottom: '0px !important'}); } </script> Hey everyone, I am new to this forums, and hope I can count on people here to help me when I need help with codes. Basically i'm building a proxy for personal use. The proxy is to do two things. 1): Go to any website I suggest (that part works already) 2): Change watever needs to be changed so I could use it at school (This is the part I need help with) The code is below, and I would appreciate anyone who could help me fix this: Code: <html> <script type = "Text/Javascript"> function Search_Web() { var data = document.getElementById('URL').value; window.location = data; } </script> <center> <h1><font color = green>Enter A Website</font></h1> <input type = "text" id = "URL" value = "" size = "50"> <input type = "Button" value = "Search Web" onClick = "Search_Web();"> </center> </html> Hi, I am trying to get a javascript if else function to initiate during the page onload. In IE the if command doesn't work if I add an else command (the command shown though the session value is set to comply with the if command). While when using Firefox neither works. Any help would be fantastic. Code: <?php session_start(); $_SESSION['ID']='x'; ?> <html> <head> <script type="text/javascript"> if ($_SESSION['ID']=='x'){ function loadXMLDoc() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } } else{ function loadXMLDoc() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_mine.txt",true); xmlhttp.send(); } } </script> </head> <body onload="loadXMLDoc()"> <div id="myDiv"><h2>Page Loading</h2></div> </body> </html> The ajax_info.txt file and the ajax_mine.txt file both show basic information only. |