TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-13-2007, 10:30 PM   #1 (permalink)
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default Limit action

Hey guys! I currently have a js function. It is called with a html link and it displays a snippet of html.

How can I limit the ammount of times this function displays the html? I want it to only show it 3 times, and after that i want it to display an error box. How can this be achieved? :)
Sam Granger is offline  
Reply With Quote
Old 10-13-2007, 11:32 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Although you might not think the same, your post is really very vague and lacking details. Post up your code, or a succinct sample, and it'll be ten times easier to provide exactly what you want.
Salathe is offline  
Reply With Quote
Old 10-13-2007, 11:50 PM   #3 (permalink)
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Although you might not think the same, your post is really very vague and lacking details. Post up your code, or a succinct sample, and it'll be ten times easier to provide exactly what you want.
Ok, right now I have a button with the following link: javascript:createFileInput();

The js createFileInput function:

PHP Code:
//** FUNCTION: Create Upload Form
    
function createFileInput(path) {
        var 
tbody document.getElementById('list_body').getElementsByTagName('tbody')[0];        
    
// Create Table Row    
        
var tr document.createElement("tr")
        if (
bg_color) { tr.className="on"bg_colorfalse; } else { bg_color true;}
    
// Create Table Cell
        
var td document.createElement("td")
        
td.id='upload_'+count;
        
td.width='100%';
        var 
output = new Array();
        
output.push("<form id='frmUpload_"+count+"' target='uploadForm' method='post' enctype='multipart/form-data' action='/cgi-bin/upload.cgi?sid="+sid+"'>");
        
output.push("<input type='hidden' name='path' value='"+path+"'>");
        
output.push("<input style='width:100%;' type='file' name='filename' ><\/form>");
        
td.innerHTML output.join('');
        
tr.appendChild(td);
        
tbody.appendChild(tr);    
        
uploads.push(count);
        if (
count != ) {
            var 
tiggerForm document.getElementById('frmUpload_'+count);
            
tiggerForm['filename'].click();
            
tiggerForm null;
        }
        
count++;

        
    } 
Sam Granger is offline  
Reply With Quote
Old 10-15-2007, 04:12 PM   #4 (permalink)
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

Sorry guys, I must of posted this when I was completely sleepy, pretty simple to do, I have completed it myself. Thanks though Salathe! ;)
Sam Granger is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 04:25 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design