I want to create a 'go forward' and 'go back' link on each of roughly 100 pages. Rather than insert a hyperlink (a href) I would like to build it from an array or list, because the actual links may change. So I was hoping there may be a way to do something like this: link xxx.html+1 or xxx.html-1 I have no idea if this is even the right forum for this!
I have a text input box where users can input values separated by a line break. What I need to do is to take those values and put them all into an array once they hit "submit".
I can do this one line at a time, but I would like to be able to do it all in one hit.
I am using this script called virtualpaginate, I have it all working but there is one thing that I would like to change. currently it displays all the paginated page number, I have 14 so it looks like "1 2 3 4 5 ... 14", What I would like to do is change the script so it will show " 1 2 3 4" once you click 4, 5 will appear once you click 5, 6 will appear and so on. I am completely stuck on how I can archive this. The section of the code I need to change is below:
Code: virtualpaginate.prototype.paginate_output_flatview=function(flatviewcontainer, divpos, anchortext){ var flatviewhtml="" var anchortext=anchortext || new Array() for (var i=0; i<this.pagecount; i++){ if (typeof anchortext[i]!="undefined") //if custom anchor text for this link exists flatviewhtml+='<a href="#flatview" rel="'+i+'">'+anchortext[i]+' |</a> ' //build pagination link using custom anchor text else flatviewhtml+='<a href="#flatview" rel="'+i+'">'+(i+1)+'</a> | ' //build pagination link using auto incremented sequential number instead } flatviewcontainer.innerHTML=flatviewhtml this.paginate_build_flatview(flatviewcontainer, divpos, anchortext) }
Below is a bulleted array, as you can see I inserted the sample url tag but it's not working, is that the wrong location?
$catArr = array( 0=>array("category"=>"Banners", "id"=>217, "nav1"=>"Events & Themes", "nav2"=>"", "headerText"=>"<h2>Templates for Full Color Banners</h2><ul><li>Choose your Banner by Event or Theme</li><li>Select a template and make it your own!</li><li>Text Position and Color are for demonstration only.<br/>You may move or change them as needed.</li><br><br> 'url'=>"http://www.google.com", back to main banner page</ul>"),
I'm trying to make a link harvester for this Chatroom. Because my friends post way too many links and I never get to view them all. So I was trying to make something to fix that.
Html is roughly:
My javascript was:
I want to make sure that I'm not saving the same links over and over. So I want them to check through the array first. But I keep getting the value undefined.
I need a counter that will display beside a link, with the number of times the same link has been clicked. I do not have FTP access to the site, since it is based on a CMS.
I am new to javascript and intend to build a custom library. After saving independent files which contain separate functions, how does one build the library?
I've got the following problem: i need to build a "progress bar" with JavaScript. So far i have the following configuration: i've got a DIV inside of a DIV. Each DIV has a style attribute that defines its width and other style information.
I need to calculate the size of the incremental block based on various factor like Width of the outside DIV, incremental interval and number of increments. My original solution was to assume that all of the units are in 'px' so i could just deal with integers. However now i hit a brick wall, when i realised that this is anything but scalable.
So what i need to do now is to obtain a width of the DIV from its style attribute (had it hard coded before), do the calculation, and then use the result to increment the size of the inner DIV (width element in the style attribute)...
I have a problem with new class implementation used with jQuery.in standard as far as I know my objects can be defined as follows:[code]will not work because 'this' refers in this case to results from xml....so how can I do it?How can I refer to property of the object PicturesList?
I am having a terrible problem with animation build up.have searched and found various codes to stop,but can't implement in the .js in a way that works.
var droplinemenu={ arrowimage: {classname: 'downarrowclass', src: 'down.gif', leftpadding: 5}, //customize down arrow image animateduration: {over: 200, out: 600}, //duration of slide in/ out animation, in milliseconds[code].....
I want to make a page that displays content based on values entered from a form... to be more precise; I have a div block - within that div is a header and paragraph. I want to present the user with a form to fill in both fields, then when they hit submit it will refresh the page and build out the div with their submitted content. (obviously what I intend to build is a bit more complex but this is the basis for it)
I want to limit to html, css, and javascript/jquery if possible.
My javascript skills arent mastery so I'll need to see it in action most likely to fully grasp how to.
I'm working on a project and I need some advice/help on how to build a slideshow using arrays in javascript. What I'm trying to accomplish is having an array of 16 different photos and a button that you can click to display the next image. When the last image is reached it will then start over at the first image. I can put all the photos in the array and I have created the next button but im not sure how to make the function.
does anyone know how I can build a regular expression e.g. for the string.search() function on runtime, depending on the content of variables? Should be something like this:
var strkey = "something"; var str = "Somethin like this";
I declare multiple variables halfway down the page. The number between "mech" and "Num" is generated dynamically in the XSL. Later on I need to reference that variable in a function, but I need to build the variable name in script. How do I convert it from a string reference to a ref to the global variable?
function changePreference(pos,mt){ //mt does not reference mech2Num, I need it to. } changePreference(2,'my' + pos + 'Num');
var mech1Num=1|2|3|4|5|6; var mech2Num=1|2|3|4|5|6; var mech3Num=1|2|3|4|5|6;
I have written an ASP.net app that pulls settings from a database. Part of the setting definition is a regular expression that I want to use on the client via JavaScript for data validation...
1) Sample code for the setting object: ---------------------------------------------------- function setting(id, name, validationPattern, validationMsg) { this.id = id; this.name = name; this.validationPattern = validationPattern; this.validationMsg = validationMsg; }
2) Sample code on the page that creates a new setting object: ---------------------------------------------------- setting(1, 'test', '^d{1,1}$|^d{2,2}$|^100$', 'invalid value');
3) The issue: ---------------------------------------------------- The setting object gets built just fine except the pattern argument gets escaped by javascript!!!
^d{1,1}$|^d{2,2}$|^100$
GETS ESCAPED TO
^d{1,1}$|^d{2,2}$|^100$ (Notice how the double is now a single )
Is there any way for me to preserve the pattern text as is?
I am just starting to use the DOM to do some more advanced javascripting so please be patient with my question if it is an ignorant question.
I would like to use the DOM to dynamically create an html table via javascript. While that table is being dynamically created in a javascript function I would like to dynamically insert text and a hyperlink with an image into each cell.
I got pretty far on my own. I was able to dynamically create a table and insert a string into each cell. However, I was not able to use the DOM to insert a hyperlink into each cell. I tried adding it as a new text node and got the text of a link rather then a link. I then tried adding and setting an anchor element but I got nothing. Code:
I'm trying to build a content slider with jQuery Cycle: [URL]
My code is here: [URL]
Basically I'm looking for a content slider with 4 slides, simple fade transition (1st slide fading in would be nice also), and each slide will link to a different page of my site. Basically this: [URL] (but with the addition of linked images...)
I'm having some problems creating a dynamic selector.I'm using the BeautyTips plugin and i can attach a tooltip to a div by using the id of the div, for example:
$('example2').bt({ // attaching to one element by id contentSelector: "$('#example2-content')" // this will return, as the tooltip's content, what's in example2-content });
I've got this XML file: <?xml version="1.0" encoding="utf-8"?> <Menu> <Section> <Title>Product Information</Title> <Topic url="howto.html">How to use This Product</Topic> <Topic url="product.html">Product Overview</Topic> <Topic url="sysreq.html">System Requirements</Topic> </Section> ..... </Menu>
There's more data than that but for brevity that's the way it's constructed and repeats with several Titles and Topics. Here's the JS I'm using to build a dynamic menu. The goal is to pick up the data and build an Accordion menu out of it: if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); //create ajax var } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); //IE } xhttp.open("GET","menu.xml",false); xhttp.send(""); xmlDoc=xhttp.responseXML; document.write("<div class='acc'>"); var x=xmlDoc.getElementsByTagName("Section"); for (i=0;i<x.length;i++) { document.write("<dt>"); document.write("<a href='#'>" + x[i].getElementsByTagName("Title")[0].childNodes[0].nodeValue + "</a></dt>"); document.write("<dd><ul>"); var y=xmlDoc.getElementsByTagName("Topic")[0].childNodes[0]; for (foo=0;foo<x.length;foo++){ document.write("<li class='acc_item'><a href='#'>" + x[i].getElementsByTagName("Topic")[0].childNodes[0].nodeValue + "</a></li>"); } document.write("</ul></dd>"); } document.write("</div>");
It creates the menu correctly... to a point. It has the correct styling, the accordion works perfectly, it has the correct Titles in the correct places, but when I "expand" one of the Titles it lists the first topic only, and lists it 5 times (the same amount of Titles I have). It then repeats this for every section. Example: Product Information How to Use This Product How to Use This Product How to Use This Product How to Use This Product How to Use This Product I'm not very confident in the syntax, or what it is exactly doing.
I am looking for code samples or websites that show me how to build a table that can split into multiple pages if there are more than certain rows. I am using AJAX to load the data into the table. But if the websites or code samples do not do AJAX, it's fine too because I maybe able to modify it to work with AJAX.
I just came across following demo application: [URL] I have a few questions about this:What is the right approach to start a project, which have heavy use of JS? how to choose which library is best, or one should develop his own library specific to requirements to keep the file size smaller?