iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-15-2008, 06:11 AM
WebProWorld New Member
 
Join Date: Aug 2008
Posts: 3
mamola500 RepRank 0
Default JavaScript problem

Hi All,

I am trying to create a JavaScript solution that will allow me to turn off the JS dependent on the page configuration. I have developed a multi-skinned web app that uses exactly the same pages for the different skins. My problem is that on skin A i want rollover action on the navigation buttons, but on skin B (which uses the same code, same page - just different CSS) i do not want JS mouseover/mouseouts on the navigation.

I have tried to store a variable on page load in an asp.net control, but am not able to read the control through javascript. Something like:-

function mouseOver8()
{
var test = document.getElementById('<%= strStyleHide %>');
}

Where strStyleHide has a value stored
alert(test) - returns nothing

any help much appreciated

Thanks
Reply With Quote
  #2 (permalink)  
Old 09-15-2008, 10:05 AM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 486
DaveSawers RepRank 3DaveSawers RepRank 3
Default Re: JavaScript problem

On the page that doesn't need the effect, make the rollover image identical to the normal image and leave the code the same.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 09-15-2008, 10:11 AM
WebProWorld New Member
 
Join Date: Aug 2008
Posts: 3
mamola500 RepRank 0
Default Re: JavaScript problem

A good idea Dave, but this wouldn't work for my scenario (i wasn't clear enough in my original post)

The rollover changes an image below the navigation menu so when i switch skins from a vertical layout to a horizontal menu layout i dont want the image to be displayed at all. I can set this to a 1px x 1px clear image, but when i rollover the nav buttons the JavaScript still stands - therefore i need to put somekind of If statement into tthe javascript to say determine which image is displayed within the image
Reply With Quote
  #4 (permalink)  
Old 09-16-2008, 05:17 PM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 349
imvain2 RepRank 1
Default Re: JavaScript problem

How do you determine what the skin is? Do you use server side programming?

Wait. I see you are using ASP.

so....

you could do something like:

Code:
function isVert(skin){
vertvar = false;
switch(skin)
{
case "a":
vertvar= true;
break;
case "b":
vertvar= true;
break;
case "c":
vertvar= false;
break;
}
return vertvar;
}

if(isVert("a")){
use vert mouse over
}
else{
use horizontal mouse over.
}
Reply With Quote
  #5 (permalink)  
Old 09-17-2008, 12:01 PM
WebProWorld New Member
 
Join Date: Aug 2008
Posts: 3
mamola500 RepRank 0
Default Re: JavaScript problem

I think my main issue was returning a value from an asp:label (in the example below this is referred to as 'lblzz') which i had assigned with a value of 0 or 1 depending on the type of skin (horizontal or vertical), once i assign this to the test variable and read test.innerHTML i was able to set up the if statement to set the source of my image to either a clear 1px * 1px square (so nothing displays) or an actual image.

I think the way i solved it was a bit of a 'bodge', but it works well enough - so i'm happy. Herte is the code i used if anyone finds it useful and thanks for the replies.

function mouseOver8()
{
setImageOver(;
}
function mouseOut8()
{
setImageOut();
}
function setImageOut()
{
var test = document.getElementById('<%= lblZZ.ClientID %>')

if (test.innerHTML == "0")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
else if (test.innerHTML == "1")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/rd_board_text.gif"
}
else
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
}
function setImageOver(a)
{
var test = document.getElementById('<%= lblZZ.ClientID %>')

if (test.innerHTML == "0")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
else if (test.innerHTML == "1")
{
var result = null;
switch (a)
{

case 1: result = "../images/house.gif"; break;

case 2: result = "../images/strength.gif"; break;

case 3: result = "../images/binoculars.gif"; break;

case 4: result = "../images/graduation.gif"; break;

case 5: result = "../images/bluepeople.gif"; break;

case 6: result = "../images/jobs.gif"; break;

case 7: result = "../images/document.gif"; break;

case 8: result = "../images/keys.gif"; break;

}

var img = document.getElementById('<%= bbb.ClientID %>');
img.src = result;
}
else
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
}
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Problem due to javascript - menu displacement mamola Graphics & Design Discussion Forum 2 06-04-2007 05:15 AM
JavaScript problem ... any help ??? kigoobe Web Programming Discussion Forum 6 04-18-2005 09:30 AM
Is JavaScript the problem here? tiger1 MSN Search Discussion Forum 0 01-25-2005 12:17 PM
Javascript and Mac Problem... dragonsteve Graphics & Design Discussion Forum 7 04-17-2004 07:28 AM
Javascript problem - 'undefined' sijpie Web Programming Discussion Forum 3 12-08-2003 12:28 PM


All times are GMT -4. The time now is 04:46 PM.



Search Engine Optimization by vBSEO 3.3.0