Conditional Includes?
Jun 18, 2001
Alright, my site is curerntly using server side includes (hoping to switch it all over to PHP soon). What I would like to do is include a different file depending on screen resolution. Does anyone know how to do this?
View 5 Replies
ADVERTISEMENT
Aug 13, 2003
is there any other way to include a js file other than this:
<SCRIPT SRC="js.js"></SCRIPT>
i want to do it because i need to put a variable in place of js, so it would be:
res = screen.width;
<SCRIPT SRC="res.js"></SCRIPT> where variable was determined earlier.
but i dont think i can do that
View 2 Replies
View Related
Jun 13, 2010
what is the advantage of using javascript files in an includes folder rather than on page?So for example i have a javascript validation on my page, does it make a difference to the way it is execute compared to if i referenced to it rather than having the full file in my page?
View 1 Replies
View Related
Nov 16, 2006
Has anyone experienced this (and found a solution)?
I have five files: a .htm that invokes four .js include files.
Only the first alert in the first include is displayed.
This only happens when I run on a client's corporate server.
I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Code:
View 7 Replies
View Related
Apr 16, 2004
I have client that has 5 versions of the same site located in web viewable root folders on his server. Aside from a few minor differences such as prices, download url's and a few text and image differences, they're the same.
Just wanted to get some opinion as to how many javascript includes I can, or should, use on the site pages or if there are any strong opinions on not doing it this way.
I'd like to place a set of javascipt files in a folder within each site, then have all pages in each site call to their specific include folder. This way I'll be able to use a single set of DW templates to manage the content on all the sites.
I can't convert to php, use ssi nor create a dynamic solution since the sites are already live and rank well in the search engines, The content I'll be wrapping in the includes is not important search engine text content.
View 1 Replies
View Related
Nov 21, 2005
I was having trouble getting the object.focus() method in IE and in FF working, so came up with this workaround.
What I wanted to do was check if a textfield was numeric, if not, inform the user then select the text and set the focus back to the field.
Sound simple? object.focus() simply doesn't work in firefox or (I've been informed) IE.
Solution:
Instead of checking when the field losing focus (onblur), check when the next field receives focus (onfocus). Then call a function that gets the element index of the object, and use that index to check the element above it. Difficult to explain.
Here it is...for the textfield you want to check, put this into the next form object after it onfocus="checkNum(this)"
then put this script in the header section...
function checkNum(obj){
var idx;
//get object index
for(idx=0;idx<document.forms[0].elements.length;idx++){
if(document.forms[0].elements[idx].name==obj.name){
break;
};
};
//check for numeric
if (isNaN(document.forms[0].elements[idx-1].value)){
alert('Value must be a number!');
document.forms[0].elements[idx-1].select();
document.forms[0].elements[idx-1].focus();
};
};
But there is one problem!!! As I just found out.
If the next field is a group option, they all have the same name and so this will not work.
for those that do not know, the function isNaN is a js function that is the same as the vbscript equivalent IsNumeric.
isNaN means isNotaNumber.
Hope this helps, I know the focus() failure of JS has been the bane of many coders.
View 4 Replies
View Related
Dec 1, 2006
This is IE issue only. Firefox and mozilla doe not have this problem.
td cell in a table with a title which includes '-'(dash). If I add a
dash between Time-Time. IE intrepets as new line os somethig and the
title is displayed in 2 line like:
Time-
Time
instead of Time-Time.
Below is snippet of the code...
View 3 Replies
View Related
Sep 24, 2010
I have created a global navigation includes document. Unfortunately the drop down menus that are part of the navigation aren't working. They worked fine when they were part of the page, but now that they are separated from the page as includes the drop down menus don't appear in my test site (posted to a web server). All other content in the includes file appears and works.
View 1 Replies
View Related
Sep 24, 2010
I've got a global navigation document with drop down menus created using javascript saved as includes. These are posted to a web server and the pages that reference the includes display the graphics and some of the links, but not the drop down menus. They don't appear on roll-over.
View 1 Replies
View Related
Aug 30, 2010
I am doing some maintenance work on a classic asp web page that displays product information. I am changing how the page looks up the available quantities for the various sizes. The old method used several SQL queries to determine the number of sizes and available quantities and then used those results to build a table on the fly on the page.
My modification consists of a web service that consolidates product size availability from three different sources and delivers the data via an XML formatted return. I have also added DOM tags in the table that is built on the fly that identify each entry with the product id and size. So, for a product that has an ID of "P12345" and a size of "XXL," that corresponding cell in the table gets an id tag of "P12345_XXL."
My jQuery update statements worked just fine using this approach until the sizes included decimal numbers. My example for this is shoe sizes. A size represented by an integer (6,7,8,...,15,16,17, etc.) works fine. A half-size represented by a decimal (6.5, 7.5, 8.5,...) does not. Even though the period is contained within a string value, jQuery doesn't seem to be able to match the value with an id tag - and yes, I have verified that the two (the string that I am giving to the jquery select and the actual tag) do indeed match.
So far, the only work-around that I have come up with is to multiply numeric sizes by 10 and parse as integer values. Is this a "known issue" and is there a more elegant solution topursue?
View 2 Replies
View Related
Jul 20, 2005
Is there anybody who knows were to find a javascript that does the trick
of conditional pulldowns (3).
Here is what i am looking for:
When you select an item from the first pulldown, the second pulldown
gets populated with the children of the item you choose. Then, when you
select an item from the newly populated second pulldown, the third
puldown gets populated.
View 1 Replies
View Related
Oct 28, 2003
Essentially, I would like the user to be prompted that application has not been completed on back, close etc. I however do not want the user to be prompted if they have completed the application.
I have a function on submit where I plan to set the flag to true.
I would expect something like the following but it doesnt work for me?
function unloadMess()
{
mess = "Leaving this page without submitting the application form will clear DOB entries. Do you wish to leave the application form?"
return mess;
}
function setBunload(on)
{
window.onbeforeunload = (on) ? unloadMess : true ;
}
if (flag = "N") // Application form has not been submitted.
{
setBunload(true);
}
else
{
setBunload(false);
}
Any Ideas?
View 7 Replies
View Related
Oct 27, 2004
i have the following regex:
(s*{s*(<?)s*(>?)s*}s*)
this needs to be able to match a string and make the following replacements:
if the string matches without < or >, replace the match with a space, a replacement string, and another space. if < matches also, do not add the left space. if > matches, do not add the right space. if < and > match, do not add the beginning or ending space
Old {} String => Old Replacement String
Old {<} String => OldReplacement String
Old {>} String => Old ReplacementString
Old {<>} String => OldReplacementString
this will have to be done a LOT of times, so efficiency is very important the answer in php is below. can anyone help me figure out how to do it in javascript? PHP Code:
View 4 Replies
View Related
Jul 20, 2005
The following script raises the subject alarm.
<p><a href="javascript:void();"
onClick="mailto:sgagnon@cyberus.ca?Subject=BRITTANY WORKSHO P">
<img align=left src="britany.gif" width="231" height="40" border=0
alt="BRITTANY WORKSHOP
with Sylvio Gagnon" style="text-indent: .2em;
background:ffffff; color:bb5500;">
</a></p>
View 10 Replies
View Related
Jul 20, 2005
I just wrote the following script for something I'm working on:
<html>
<head>
<script type="text/javascript">
function KP_growit(subject,widthto,heightto) {
var target = document.getElementById(subject);
var tweenit = setInterval(grower,10);
function grower() {
(parseInt(target.style.width) < widthto)? target.style.width =
(parseInt(target.style.width) + 10) + "px";
(parseInt(target.style.height) < heightto)? target.style.height =
(parseInt(target.style.height) + 10) + "px";
(parseInt(target.style.width) == widthto && parseInt(target.style.height)
== heightto)? clearInterval(tweenit);
}
}
</script>
</head>
<body>
<div id="bluebox" style="position:absolute; left:173px; top:48px;
width:100px; height:80px; z-index:1; background-color:#99CCFF;"></div>
<div><a href="#" onClick="KP_growit('bluebox',400,300); return false;">grow
it</a></div>
</body>
</html>
I noticed that the script does not work because of the conditional
operators; however it DOES work when using the if...else format. Why is
this?
View 4 Replies
View Related
Oct 10, 2010
I am making a form where you can either upload images or link images and upload a video. The problem is that I want a or situation. I made javascript function that when you click one of the 3 images it will add in one item this could be a image link or uploaded image or a video. There is only one function that runs and inside that function has if statements to figure out which one image was clicked.
I have 3 images one is for image links one for uploading images and one for uploading video. the problem is that I want the user to append only image links and uploaded image or uploaded video.
I am only allowing 8 images to be uploaded or 1 video. This is a form that submits a message with either of the above but I only want to append only the images or the video but not both.
View 4 Replies
View Related
Mar 26, 2010
This is the loop I'm trying to use to check for bullets hitting rocks. the function worked if I used actual numbers instead of the j variable, but I wanted to loop through all the rocks.Can anyone see why the inner function loses the j index and says asteroids[j] is undefined? the hit test is removing the bullets! it's working! the asteroids[j] was used in the hit test!
View 6 Replies
View Related
Sep 13, 2011
I'm trying to create a test using Javascript. Actually, I did this in PHP, but we need to put it a server that does nor run it, I think I can convert it to Javascript. I hope it'll be work as in PHP somehow. Test will be composed of 15 questions and each question has either "Yes" or "No" as answer. And, I use radio buttons here for answers. By the way, there will be more than one radio groups. Now, I want to check the value of clicked radio button in each group and use an if-statement to determine if it's correct. And, if it's correct, I want to increment a variable by 1. Finally, by the resulted variable incremented for each question in the test, I want to use another if-statement to show specific result message for and interval of that variable.
[Code]...
View 4 Replies
View Related
Sep 1, 2007
I am trying to create a conditional comment scenario that is based on a web address. I am working with an ecommerce site that I want to put a nav menu promotion on all the pages except the home page. The system we are using only allows a post promotion to ALL or one specified URL.
I have tried everything I can think of to create a URL condition based comment but nothing has worked. I tried modifying the code below to change the if output to a variable comment tag and then write the variable further in the script with a document.write.
<SCRIPT LANGUAGE="JavaScript">
<!--
url=location.href
if (url=="http://www.sitename.com") {alert("Welcome To sitename")}
else {alert("welcome")};
// -->
View 3 Replies
View Related
Jul 4, 2011
With the exception of the boolean variable, I'm wondering if it's possible to combine the bottom 2 into one statement, so s exists in the current scope
Code:
var boolean = (true or false)
var s;
boolean ? s = 40 : s = 80;
View 3 Replies
View Related
Oct 4, 2010
I have a very simple script that generates a prompt window. Instead of using a default text, I have left the text field empty. However, I would like a default message to display in the pop up window if the user does not enter a value in the prompt box before clicking okay. I tried adding a conditional statement but the default text does not write in the pop up window.
Here is the code:
Code:
function promptBox(){
var message = prompt("Who is your favorite Hollywood Star?", "");
newWindow = window.open('','','width=800,height=600');
newWindow.document.write(message);
newWindow.focus();
if ((prompt) == null);
document.write("No Value Entered");
}
View 5 Replies
View Related
Oct 13, 2010
I want to create a conditional form using cookies to restore the state of a radio button if wrong data is entered into one of the textfields on my website. A tutorial on Onextrapixel explains something similar and I was trying to modify it according to my needs.
The following code shows the script I am using. I tried to .hide() or .show() the specific content according to which radio button is clicked. Hiding the right content works without any problem if I disable the cookie stuff.
[Code]...
View 3 Replies
View Related
Jul 26, 2011
i have a asp.net required field validator with a validationgroup setting to show a validation summary. some of my form fields are either shown or hidden depending on selections elsewhere. if a div containing a form textbox is hidden i want to hide this element from showing up as a required field in the validation summary so effectively needto remove the validationgroup="mygroup" from the validation control. how would i do this? i know how to check if a div is visible or hidden but not how to use it to conditionally set the validator control attributes.
View 3 Replies
View Related
Jan 3, 2012
I am building an application where more than one device can change settings on a webserver.Imagine using 2 smartphones. If a button on smartphone#1 is being pressed by a user, then on the webserver the status changes from 0 -> 1. I need both smartphone#1 and smartphone#2 to change from 0->1 and vice-versa so that the user knows the current value of the status.How can I accomplish this? Meaning, if I want to make a toggle switch.I read on the website:The first option will be styled as the "on" state switch and the second will be styled as the "off" state so write your options in the correct order.[code]My first guess is to create a function in the <head> in script, with one for the on and one for the off state.Depending on the current value I either load one of the two codes in the <body> section.The script in the <head> decides.
View 1 Replies
View Related
Mar 19, 2009
In my form I want user to Rate on a scale of 1-6 the importance of 6 questions that they have just answered.How can I Select 1 - 6 from a dropdown but have each selection be conditional...so the same number can't be selected twice.
View 4 Replies
View Related
Jun 8, 2005
In javascript, I want to do run a script based on the contents of a page. My page called page.php either contains only a 1 or is totally blank, and I want, from another page, to query the contents of that page in the form of an if, then, else statement. Code:
View 1 Replies
View Related